<?php
/**
 * User: b179a9
 * Date: 13.09.11
 * Time: 16:49
 */

namespace Managers;

class Params extends BaseManager
{

    protected $__table = '\Catalog\Params';

    function getParams()
    {
        $res = $this->_em->createQueryBuilder()
                ->select('p')
                ->from($this->__table, 'p')
                ->getQuery()
                ->getArrayResult();

        return count($res) ? $res[0] : false;
    }

    function setParams($email) {
        $repository = $this->_em->getRepository($this->__table)->findAll();
        $params = $repository[0];
        $params->setAdminEmail($email);

        $this->_em->persist($params);
        $this->_em->flush();
        return $params;
    }

}
